package UIWindows;

import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JFrame;

public class jFramePrincipal extends JFrame {
        
    
    public jFramePrincipal() {
        this.setExtendedState(JFrame.MAXIMIZED_BOTH);//inicia maximizado       
        initComponents();
    }
    public static void main() {    
           //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
           /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
            * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
            */
           try {
               for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                   if ("Nimbus".equals(info.getName())) {
                       javax.swing.UIManager.setLookAndFeel(info.getClassName());
                       break;
                   }
               }
           } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {
               java.util.logging.Logger.getLogger(jFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
           }
           //</editor-fold>
           java.awt.EventQueue.invokeLater(new Runnable() {
               @Override
               public void run() {
                   new jFramePrincipal().setVisible(true);
               }
           });
       }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPopupMenuObjetos = new javax.swing.JPopupMenu();
        jMenuItemEditarObjeto = new javax.swing.JMenuItem();
        jMenuItemEliminarObjeto = new javax.swing.JMenuItem();
        jToolBar = new javax.swing.JToolBar();
        jButNewObjeto = new javax.swing.JButton();
        jButNewMortal = new javax.swing.JButton();
        buNewProyectil = new javax.swing.JButton();
        jSpInfo = new javax.swing.JSplitPane();
        jPanelInfo = new javax.swing.JPanel();
        jSplitPaneInfo = new javax.swing.JSplitPane();
        jScrollPanelPlano = new javax.swing.JScrollPane();
        jPanelPlano = new javax.swing.JPanel();
        jScrollPaneLog = new javax.swing.JScrollPane();
        jTxtAreaLog = new javax.swing.JTextArea();
        PanelObjetos = new javax.swing.JPanel();
        jSplitPaneListas = new javax.swing.JSplitPane();
        jPanelListaObjetos = new javax.swing.JPanel();
        jScrollPaneArbol = new javax.swing.JScrollPane();
        jTreeObjects = new javax.swing.JTree();
        jPanelPropiedades = new javax.swing.JPanel();
        jLabelPropiedades = new javax.swing.JLabel();
        jLabelX = new javax.swing.JLabel();
        jLabelY = new javax.swing.JLabel();
        jLabelZ = new javax.swing.JLabel();
        jMenuPrincipal = new javax.swing.JMenuBar();
        jMenuFile = new javax.swing.JMenu();
        jMenuNew = new javax.swing.JMenuItem();
        jMenuItemSave = new javax.swing.JMenuItem();
        jMenuItemLoad = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jMenuItemExit = new javax.swing.JMenuItem();
        jMenuEdit = new javax.swing.JMenu();

        jMenuItemEditarObjeto.setText("Editar propiedades");
        jPopupMenuObjetos.add(jMenuItemEditarObjeto);

        jMenuItemEliminarObjeto.setText("Eliminar objeto");
        jPopupMenuObjetos.add(jMenuItemEliminarObjeto);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Calculadora de trayectorias de morteros");
        setIconImage(getIconImage());

        jToolBar.setFloatable(false);
        jToolBar.setRollover(true);

        jButNewObjeto.setText("Añadir objeto al plano");
        jButNewObjeto.setFocusable(false);
        jButNewObjeto.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButNewObjeto.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButNewObjeto.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButNewObjetoMouseClicked(evt);
            }
        });
        jButNewObjeto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButNewObjetoActionPerformed(evt);
            }
        });
        jToolBar.add(jButNewObjeto);

        jButNewMortal.setText("Nuevo tipo de mortero");
        jButNewMortal.setFocusable(false);
        jButNewMortal.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButNewMortal.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButNewMortal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButNewMortalActionPerformed(evt);
            }
        });
        jToolBar.add(jButNewMortal);

        buNewProyectil.setText("Nuevo tipo de proyectil");
        buNewProyectil.setFocusable(false);
        buNewProyectil.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        buNewProyectil.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar.add(buNewProyectil);

        jSpInfo.setDividerLocation(300);

        jPanelInfo.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jSplitPaneInfo.setDividerLocation(600);
        jSplitPaneInfo.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jScrollPanelPlano.setBackground(new java.awt.Color(51, 51, 51));
        jScrollPanelPlano.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jPanelPlano.setBackground(new java.awt.Color(102, 102, 102));
        jPanelPlano.setBorder(javax.swing.BorderFactory.createCompoundBorder());
        jPanelPlano.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        javax.swing.GroupLayout jPanelPlanoLayout = new javax.swing.GroupLayout(jPanelPlano);
        jPanelPlano.setLayout(jPanelPlanoLayout);
        jPanelPlanoLayout.setHorizontalGroup(
            jPanelPlanoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 652, Short.MAX_VALUE)
        );
        jPanelPlanoLayout.setVerticalGroup(
            jPanelPlanoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 580, Short.MAX_VALUE)
        );

        jScrollPanelPlano.setViewportView(jPanelPlano);

        jSplitPaneInfo.setTopComponent(jScrollPanelPlano);

        jTxtAreaLog.setEditable(false);
        jTxtAreaLog.setColumns(20);
        jTxtAreaLog.setRows(5);
        jScrollPaneLog.setViewportView(jTxtAreaLog);

        jSplitPaneInfo.setRightComponent(jScrollPaneLog);

        javax.swing.GroupLayout jPanelInfoLayout = new javax.swing.GroupLayout(jPanelInfo);
        jPanelInfo.setLayout(jPanelInfoLayout);
        jPanelInfoLayout.setHorizontalGroup(
            jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSplitPaneInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 628, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanelInfoLayout.setVerticalGroup(
            jPanelInfoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelInfoLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSplitPaneInfo, javax.swing.GroupLayout.DEFAULT_SIZE, 785, Short.MAX_VALUE)
                .addContainerGap())
        );

        jSpInfo.setRightComponent(jPanelInfo);

        PanelObjetos.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jSplitPaneListas.setDividerLocation(400);
        jSplitPaneListas.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);

        jScrollPaneArbol.setViewportView(jTreeObjects);

        javax.swing.GroupLayout jPanelListaObjetosLayout = new javax.swing.GroupLayout(jPanelListaObjetos);
        jPanelListaObjetos.setLayout(jPanelListaObjetosLayout);
        jPanelListaObjetosLayout.setHorizontalGroup(
            jPanelListaObjetosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelListaObjetosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPaneArbol, javax.swing.GroupLayout.DEFAULT_SIZE, 255, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanelListaObjetosLayout.setVerticalGroup(
            jPanelListaObjetosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelListaObjetosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPaneArbol, javax.swing.GroupLayout.DEFAULT_SIZE, 377, Short.MAX_VALUE)
                .addContainerGap())
        );

        jSplitPaneListas.setTopComponent(jPanelListaObjetos);

        jPanelPropiedades.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

        jLabelPropiedades.setText("Propiedades de Objetos");

        jLabelX.setText("X");

        jLabelY.setText("Y");

        jLabelZ.setText("Z");

        javax.swing.GroupLayout jPanelPropiedadesLayout = new javax.swing.GroupLayout(jPanelPropiedades);
        jPanelPropiedades.setLayout(jPanelPropiedadesLayout);
        jPanelPropiedadesLayout.setHorizontalGroup(
            jPanelPropiedadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelPropiedadesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelPropiedadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelPropiedades, javax.swing.GroupLayout.DEFAULT_SIZE, 253, Short.MAX_VALUE)
                    .addComponent(jLabelZ, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabelY, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jLabelX, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanelPropiedadesLayout.setVerticalGroup(
            jPanelPropiedadesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelPropiedadesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabelPropiedades)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelX)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelY)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelZ)
                .addContainerGap(292, Short.MAX_VALUE))
        );

        jSplitPaneListas.setRightComponent(jPanelPropiedades);

        javax.swing.GroupLayout PanelObjetosLayout = new javax.swing.GroupLayout(PanelObjetos);
        PanelObjetos.setLayout(PanelObjetosLayout);
        PanelObjetosLayout.setHorizontalGroup(
            PanelObjetosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelObjetosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSplitPaneListas)
                .addContainerGap())
        );
        PanelObjetosLayout.setVerticalGroup(
            PanelObjetosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelObjetosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSplitPaneListas)
                .addContainerGap())
        );

        jSpInfo.setLeftComponent(PanelObjetos);

        jMenuFile.setText("Archivo");

        jMenuNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        jMenuNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/UIWindows/Iconos/iconoNuevoEscenario.png"))); // NOI18N
        jMenuNew.setText("Nuevo escenario");
        jMenuNew.setToolTipText("");
        jMenuNew.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jMenuNewMouseClicked(evt);
            }
        });
        jMenuFile.add(jMenuNew);

        jMenuItemSave.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemSave.setText("Guardar escenario");
        jMenuFile.add(jMenuItemSave);

        jMenuItemLoad.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItemLoad.setText("Cargar escenario");
        jMenuItemLoad.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemLoadActionPerformed(evt);
            }
        });
        jMenuFile.add(jMenuItemLoad);
        jMenuFile.add(jSeparator1);

        jMenuItemExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        jMenuItemExit.setText("Salir");
        jMenuItemExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItemExitActionPerformed(evt);
            }
        });
        jMenuFile.add(jMenuItemExit);

        jMenuPrincipal.add(jMenuFile);

        jMenuEdit.setText("Edicion");
        jMenuPrincipal.add(jMenuEdit);

        setJMenuBar(jMenuPrincipal);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSpInfo)
                    .addComponent(jToolBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jToolBar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSpInfo)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButNewObjetoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButNewObjetoMouseClicked
        nuevoObjeto();
    }//GEN-LAST:event_jButNewObjetoMouseClicked

    private void jMenuNewMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuNewMouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuNewMouseClicked

    private void jButNewObjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButNewObjetoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButNewObjetoActionPerformed

    private void jMenuItemLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLoadActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItemLoadActionPerformed

    private void jMenuItemExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemExitActionPerformed
        this.dispose();
    }//GEN-LAST:event_jMenuItemExitActionPerformed

    private void jButNewMortalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButNewMortalActionPerformed
        nuevoMortero();
    }//GEN-LAST:event_jButNewMortalActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel PanelObjetos;
    private javax.swing.JButton buNewProyectil;
    private javax.swing.JButton jButNewMortal;
    private javax.swing.JButton jButNewObjeto;
    private javax.swing.JLabel jLabelPropiedades;
    private javax.swing.JLabel jLabelX;
    private javax.swing.JLabel jLabelY;
    private javax.swing.JLabel jLabelZ;
    private javax.swing.JMenu jMenuEdit;
    private javax.swing.JMenu jMenuFile;
    private javax.swing.JMenuItem jMenuItemEditarObjeto;
    private javax.swing.JMenuItem jMenuItemEliminarObjeto;
    private javax.swing.JMenuItem jMenuItemExit;
    private javax.swing.JMenuItem jMenuItemLoad;
    private javax.swing.JMenuItem jMenuItemSave;
    private javax.swing.JMenuItem jMenuNew;
    private javax.swing.JMenuBar jMenuPrincipal;
    private javax.swing.JPanel jPanelInfo;
    private javax.swing.JPanel jPanelListaObjetos;
    private javax.swing.JPanel jPanelPlano;
    private javax.swing.JPanel jPanelPropiedades;
    private javax.swing.JPopupMenu jPopupMenuObjetos;
    private javax.swing.JScrollPane jScrollPaneArbol;
    private javax.swing.JScrollPane jScrollPaneLog;
    private javax.swing.JScrollPane jScrollPanelPlano;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JSplitPane jSpInfo;
    private javax.swing.JSplitPane jSplitPaneInfo;
    private javax.swing.JSplitPane jSplitPaneListas;
    private javax.swing.JToolBar jToolBar;
    private javax.swing.JTree jTreeObjects;
    private javax.swing.JTextArea jTxtAreaLog;
    // End of variables declaration//GEN-END:variables

    @Override
    public Image getIconImage() { //para establecer el icono del jFrame
        Image retValue = Toolkit.getDefaultToolkit().
                getImage(ClassLoader.getSystemResource("UIWindows/Iconos/IconoInicialMortero.png"));
        return retValue;
    }
    private void nuevoObjeto() {
        UIWindows.JDialogNewObjeto.main(null);
    }
    private void nuevoMortero() {
        JDialogNewMortalType.main();
    }
 
}
